package random;

import java.util.Random;
import java.util.concurrent.ThreadLocalRandom;

/**
 * @author Created by chenxin34 on 2018/7/18 上午10:24.
 */
public class RandomTest {
    public static void main(String[] args) {
//        testRandom();
//        System.out.println("---------------------");
//        testRandom();
//        System.out.println("---------------------");
//        testRandom();

        for (int i = 0; i < 100; i++) {
            randomNm();
        }
    }

    public static void testRandom(){
        Random random = new Random(1);
        for(int i=0; i<5; i++){
            System.out.print(random.nextInt()+"\t");
        }
        System.out.println("");
    }

    private static void randomNm() {
        long minBound = 200;
        long maxBound = 5000;

        long random = (long) (ThreadLocalRandom.current().nextDouble() * (maxBound - minBound + 1)) + minBound;
        System.out.println(random);
    }

    private static void gaussian() {
        ThreadLocalRandom random = ThreadLocalRandom.current();
        int a = 100;
        int b = 100;
        double sum = 0;
        double s2 = 0;
        for (int i = 0; i < 1000; i++) {
            double x= Math.sqrt(b)*random.nextGaussian()+a;
            System.out.println(x);
            sum += x;
        }
    }
}
